home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / dir.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  3KB  |  91 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /*  Dir.c  */
  21.  
  22. #include <externs.h>
  23.  
  24.  
  25.  
  26. void AVL_SET_DIRECTORIES()
  27. {
  28.     char f[2][AVL_MAX_LINEL+10];
  29.     AVL_EDIT_WINDOW_PTR w;
  30.     AVL_WIN_PTR m;
  31.     int n1, n2, ch, i;
  32.     static char *msg = " GWAda - Directories ";
  33.     static char *msgs[4] = {"Ada sources: "
  34.                            ,"Library    : "
  35.                            ,"Ok" 
  36.                            ,"Cancel"};
  37.     int current = 1;
  38.     w = &avl_windows[avl_window];
  39.     n1 = 66;
  40.     n2 = (80 - n1) / 2;
  41.     strcpy(f[0],avl_dir_sources);
  42.     strcpy(f[1],avl_dir_library);
  43.     m = AVL_MAKE_WINDOW(msg,7,n2,12,n1+n2,avl_wnd_bk_color,avl_wnd_color);
  44.     while ( 1 )  {
  45.         for(i = 1; i < 5; ++i)  {
  46.             _settextposition(i,1);
  47.             _settextcolor(avl_men_letter);
  48.             _outmem(msgs[i-1],1);
  49.             _settextcolor(avl_men_word);
  50.             _outtext(msgs[i-1] + 1);
  51.             if (i < 3)
  52.                 _outtext(f[i-1]);
  53.             }
  54.         ch = getch();
  55.         switch( toupper(ch) )  {
  56.             case 'A' :
  57.                 current = 1;
  58.                 AVL_PROMPT(current,strlen(msgs[current-1]) + 1,f[current-1],40);
  59.                 break;
  60.             case 'L' :
  61.                 current = 2;
  62.                 AVL_PROMPT(current,strlen(msgs[current-1]) + 1,f[current-1],40);
  63.                 break;
  64.             case 'O' :
  65.                     strcpy(avl_dir_sources,f[0]);
  66.                     strcpy(avl_dir_library,f[1]);
  67.                     AVL_DEL_WINDOW(m);
  68.                     return;
  69.             case 27  :
  70.             case 'C' :
  71.                     AVL_DEL_WINDOW(m);
  72.                     return;
  73.             case 0   : 
  74.             case 0XE0: {
  75.                 ch = getch();
  76.                 switch(ch)  {
  77.                     case 72 : /* Up  */ 
  78.                         if (--current < 1) current = 2;
  79.                         break;
  80.                     case 80 : /* Down */ 
  81.                         if (++current > 2) current = 1;
  82.                         break;
  83.                     default : putch(7); break;
  84.                     }
  85.                 break;
  86.                 }
  87.             default : putch(7); break;
  88.             }
  89.         }
  90. }
  91.